package com.kkd.kkdapp.adapter;

import java.util.List;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.kkd.kkdapp.R;
import com.kkd.kkdapp.base.MyBaseAdapter;
import com.kkd.kkdapp.http.entity.ManageAwardDataList;

public class ManageAwardAdapter extends MyBaseAdapter<ManageAwardDataList> {

	private List<ManageAwardDataList> dataList;

	public ManageAwardAdapter(Context context) {
		super(context);
		dataList = this.getAdapterData();
	}

	@Override
	public View getMyView(int position, View convertView, ViewGroup parent) {
		ViewHodler mViewHodler;
		if (convertView == null) {
			convertView = View.inflate(context, R.layout.manage_award_item,
					null);
			mViewHodler = new ViewHodler();
			mViewHodler.title = (TextView) convertView.findViewById(R.id.title);
			mViewHodler.loansTime = (TextView) convertView
					.findViewById(R.id.credit_tv);
			mViewHodler.bidPeriod = (TextView) convertView
					.findViewById(R.id.deadline);
			mViewHodler.bidPeriodDesc = (TextView) convertView
					.findViewById(R.id.deadline_t);
			mViewHodler.bidAmount = (TextView) convertView
					.findViewById(R.id.tender);
			mViewHodler.amount = (TextView) convertView
					.findViewById(R.id.friend);
			convertView.setTag(mViewHodler);
		} else {
			mViewHodler = (ViewHodler) convertView.getTag();
		}
		mViewHodler.title.setTag(position);
		mViewHodler.title.setText(dataList.get(position).getBidTitle());
		mViewHodler.loansTime.setTag(position);
		mViewHodler.loansTime.setText(dataList.get(position).getLoansTime());
		mViewHodler.bidPeriod.setTag(position);
		mViewHodler.bidPeriod.setText(dataList.get(position).getBidPeriod());
		mViewHodler.bidPeriodDesc.setTag(position);
		mViewHodler.bidPeriodDesc.setText(dataList.get(position)
				.getBidPeriodDesc());
		mViewHodler.bidAmount.setTag(position);
		mViewHodler.bidAmount.setText(dataList.get(position).getBidAmount());
		mViewHodler.amount.setTag(position);
		mViewHodler.amount.setText(dataList.get(position).getAmount());
		return convertView;
	}

	class ViewHodler {
		TextView title;
		TextView loansTime;
		TextView bidPeriod;
		TextView bidPeriodDesc;
		TextView bidAmount;
		TextView amount;
	}
}
